home *** CD-ROM | disk | FTP | other *** search
- 1 rem
- 2 rem problem #24-1 :
- 3 rem printing permutations
- 4 rem solution by
- 5 rem allan flippin
- 6 rem.
- 100 clr:input n:dimc(n-1):for i=1 to n:s$=s$+chr$(48+i):next
- 110 i=n-1:print s$,
- 120 s$=left$(s$,i-1)+right$(s$,n-i)+mid$(s$,i,1)
- 130 c(i)=c(i)+1:if c(i)<=n-i goto 110
- 140 c(i)=0:if i>1 then i=i-1 : goto 120
-